package at.dahu4wa.fxclient.modules.imageview;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.image.Image;
import at.dahu4wa.fxclient.Main;
import at.dahu4wa.fxclient.framework.IFController;


public class ImageController implements IFController {
	private ImageViewer view;
	public  Image image1;
	@Override
	public void init() {
		
		Main.getMainController().getTopMenu().getOpenMenu().setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				
					view.openImage();
			}
		});
		
		view = new ImageViewer();
		Image image1 = new Image("http://www.winboard.org/news-attachments/64790d1362479700-java-logo.jpg.html",true);
		view.setImage(image1);
		
		
		for( int i=0; i<=5 ;i++){
			
			view.addParameter(String.format("Item%d",i), new IFValChanged() {
				
				@Override
				public void setValue(double val) {
					System.out.println("Item changed to Value " + val);
					
				}
			});
			
			
		}
		
		
		//registerListeners();
		// TODO Auto-generated method stub
		
	}

	@Override
	public String getTitle() {
		// TODO Auto-generated method stub
		return "ImageViewer";
	}

	@Override
	public Node getView() {
		// TODO Auto-generated method stub
		return view;
	}

}
